using System;

namespace EstimationStudio.Core
{
    /// <summary>
    ///  The <see cref="AdjustmentFactor"/> class represents a single factor that can be used to adjust
    ///  an <see cref="Estimate"/> based on the <see cref="AdjustmentVariability"/> value specified.
    /// </summary>
    [Serializable]
    public class AdjustmentFactor
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="AdjustmentFactor"/> class.
        /// </summary>
        public AdjustmentFactor()
        {
            CurrentRating = Rating.Nominal;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="AdjustmentFactor"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="description">The description.</param>
        /// <param name="ratings">The ratings.</param>
        public AdjustmentFactor(String name, String description, AdjustmentVariability ratings)
            : this()
        {
            Name = name;
            Description = description;
            AdjustmentVariability = ratings;
        }

        /// <summary>
        /// Gets the name of this <see cref="AdjustmentFactor"/>.
        /// </summary>
        /// <value>The name.</value>
        public String Name { get; set; }

        /// <summary>
        /// Gets the description of this <see cref="AdjustmentFactor"/>.
        /// </summary>
        /// <value>The description.</value>
        public String Description { get; set; }

        /// <summary>
        /// Gets the <see cref="AdjustmentVariability"/> for this <see cref="AdjustmentFactor"/>.
        /// </summary>
        /// <value>The ratings.</value>
        public AdjustmentVariability AdjustmentVariability { get; set; }

        /// <summary>
        /// Gets or sets the current rating for this <see cref="AdjustmentFactor"/>.
        /// </summary>
        /// <value>The current rating.</value>
        public Rating CurrentRating { get; set; }

        /// <summary>
        /// Gets the current value for this <see cref="AdjustmentFactor"/>.
        /// </summary>
        /// <value>The value.</value>
        public Double Value
        {
            get { return AdjustmentVariability[CurrentRating]; }
        }

        /// <summary>
        /// Gets the current influence value of this <see cref="AdjustmentFactor"/>.
        /// </summary>
        /// <value>The influence value of this <see cref="AdjustmentFactor"/>.</value>
        public Double Influence
        {
            get { return AdjustmentVariability.Influence; }
        }
    }
}